package com.xiaoqi.springboot.controller;

import com.xiaoqi.springboot.bean.User;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @Author Rookie Coder
 * @Description
 * @Date
 **/
@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/login")
    @ResponseBody
    public String login(HttpServletRequest request){
        User user = new User("xiaoqi","140489");
        HttpSession session = request.getSession();
        session.setAttribute("user",user);
        return "login";

    }

    @RequestMapping("/centent")
    @ResponseBody
    public String centent(){
        return "centent";
    }

    @RequestMapping("/error")
    @ResponseBody
    public String error(){
        return "error";
    }

    @RequestMapping("/anyPage")
    @ResponseBody
    public String anyPage(){
        return "anyPage";
    }


}
